<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
<div class="FormDialog">
    <el-row>
      <el-col :span="24" class="margin_col">
        <dev>
          <div class="zhibo" style="width: 100%; height: 85vh;">
            <iframe :src="livelessinUrl" frameborder="0" allowfullscreen="true" style="width: 100%; height: 100%;"></iframe>
          </div>
        </dev>
      </el-col>
    </el-row>
<!--    <aqsc-layout>-->
<!--      <div class="zhibo" style="width: 100%; height: 85vh;">-->
<!--        <iframe :src="livelessinUrl" frameborder="0" allowfullscreen="true" style="width: 100%; height: 100%;"></iframe>-->
<!--      </div>-->
<!--    </aqsc-layout>-->
  </div>
</template>
<script>
import axios from "axios";
export default {
  name: 'Worktaskform',
  components: {
  },
  props: {
    types: {
      type: Number,
      default: 1
    },
    formDataFlow: {
      type: Object,
      default: () => ({})
    },
    id: String
  },
  data() {
    return {
      // userinfo: JSON.parse(sessionStorage.getItem("userinfo")),
      tablehide: false, // 课程附件是否隐藏
      tableData: [], // 课程附件
      editStatus: false, // 控制课程附件
      uploadUrl: "/omim_wisdom_safe_zdfd/process/Common_File?action=upload",
      moduletype: '课程库', // 模块类型
      moduleintype: "课程附件", // 子模块类型，默认为空
      dialogVisible: false, // table格式的上传组件是否显示 默认为false
      // 更新通知参数
      updatemessage: {
        businessid: '',
        msgtype: '',
        staffcode: '',
        msgresource: ''
      },
      pindaonum: '',
      livelessinUrl: '',
      leveloptions: [],
      specialoptions: [],
      sortoptions: [],
      depictoptions: [],
      singlehanderoptions: [{
        value: 1,
        label: '是'
      }, {
        value: 2,
        label: '否'
      }],
      value1: '',
      operationStatus: false,
      startDate: '',
      endDate: '',
      listLoading: false,
      datasDT: [],
      tableVisible: false, // 控制批量审核弹框
      formAudit: {
        ids: [],
        taskid: '',
        review: ''
      },
      canceltask: {
        ids: [],
        taskid: '',
        state: 6
      },
      formDataRules: {
        teachcast_name: [
          { required: true, message: "直播课名称不能为空", trigger: "change" }
        ],
        teachcast_content: [
          { required: true, message: "直播内容不能为空", trigger: "change" }
          // { pattern: /^[0-9]*$/, message: '提醒天数只能是数字' }
        ],
        teacher_name: [
          { required: true, message: "直播教师不能为空", trigger: "change" }
        ],
        teachcast_time: [
          { required: true, message: "直播时间不能为空", trigger: "change" }
        ],
        teachcast_depc_name: [
          { required: true, message: "直播对象不能为空", trigger: "change" }
        ]
      }, // 表单验证
      formData: {
        teachcast_name: '', // 直播课名称
        teachcast_content: '', // 直播内容
        teacher_name: '', // 直播教师
        teachcast_time: '', // 直播时间
        teachcast_depc_name: '', // 直播对象
        create_by: '',
        is_del: 0,
        create_time: ''

      },
      isEdit: false, // 默认详情不可编辑
      showfinishedinfo: false, // 控制完成情况的显示与否，默认不显示
      showdelayreason: false, // 控制延期原因的显示与否，默认不显示
      tableHeight: 200,
      auditform: {
        taskid: '',
        finishedinfo: '',
        state: 3,
        finishdate: '',
        realyenddate: ''
      },
      delayprocessform: {
        taskid: '',
        delayreason: '',
        state: 5,
      },
      dispatchflag: true, // 派发课程按钮可用
      cancelflag: true, // 取消课程变量初始化
      saveflag: true, // 保存按钮可用
      editflag: true, // 编辑按钮控制
      tjshyqblbtn: 0, // 提交审核和延期办理按钮控制
      saveflow: 0, // 保存流程, 0:保存主表，1:保存完成情况，2:保存延迟原因
      selects: [],
      msg: '', // 查看传递的记录id
      taskid: '',
      detailid: ''
    }
  },
  created() {
    this.formData = this.$route.query.formData
    console.log(this.formData)
    this.livelessinUrl = 'https://live.polyv.cn/watch/' + this.formData.channelid
  },
  mounted() {
    // const iframe = this.$refs.myFrame;
    // iframe.onload = function() {
    //   const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
    //   const iframeHeight = iframeDocument.documentElement.scrollHeight;
    //   iframe.style.height = iframeHeight + 'px';
    // };
  },
  methods: {
    parentClick(id) {
      // this.$refs.mychild.queryDetail(id); // 调用子组件的方法queryDetail获取详细信息
    },
    /**
     * 编辑
     */
    edit() {
      this.saveflag = true;
      this.saveflow = 0;
      this.isEdit = true;
      this.editStatus = true;
    },
    // 课程附件--start
    success(fileList) {
      // 获取fileList
      this.tableData = this.tableData.concat(fileList);
    },
    failure(response) {
    },
    handleReturn() {
      this.$emit('switchTable');
      this.editStatus = false; // 执行附件按钮复位
      this.editStatus1 = false; // 执行附件按钮复位
    },
    /**
     * 保存方法
     */
    saveValidate() {
      this.$refs['infoForm'].validate((valid) => {
        if (valid) {
          if (this.saveflow === 0) {
            this.savemain();
          }
        }
      });
    },
    savemain() {
      debugger
      this.formData.werks = this.userinfo.werks;// 工厂
      this.formData.bukrs = this.userinfo.bukrs;// 公司
      this.formData.create_by = this.userinfo.id;// 创建人
      this.formData.create_time = this.formData.adddate;// 创建时间
      this.formData.teachcast_time = dateFtt('yyyy-MM-dd hh:mm:ss', new Date(this.formData.teachcast_time));
      console.log(this.formData)
      postMethod('/omim_wisdom_safe_zdfd/process/setteachcast?method=save', this.formData).then(response => {
        const success = response.success;
        console.log(response)
        if (success === true) {
          this.$message.success('保存成功!');
          // 保存课程附件
          this.$emit('switchTable');
        } else {
          this.$message.error('数据保存失败!')
        }
      })
    }
  }
}
</script>
<style>

</style>
